﻿using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Domain;
using MyMES.Domain.yjb;
using MyMES.Error;
using MyMES.Infrastructure.Interface;
using MyMES.Read.API.Application.Commends.settingCommand;
using MyMES.Read.API.Dtos;

namespace MyMES.Read.API.Controllers.Setting
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SettingController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ILogger<SettingController> logger;
        private readonly IBaseRepository<Nlog> accreop;
        private readonly IMapper mapper;

        public SettingController(IMediator mediator, ILogger<SettingController> logger, IBaseRepository<Nlog> accreop, IMapper mapper)
        {
            this.mediator = mediator;
            this.logger = logger;
            this.accreop = accreop;
            this.mapper = mapper;
        }

        /// <summary>
        /// 仓库设置显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("SettingShow")]
        public async Task<APIPaging<List<Warehouse>>> SettingShow([FromQuery] seetingShowCommand request)
        {
            logger.LogInformation($"在{DateTime.Now}显示了");
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<ProcessInfo>>> ProcessingoShow([FromQuery] ProcessInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 生产排产显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<WorkOrderInfo>>> WorkOrder([FromQuery] WorkOrderInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 排产显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<TaskInfo>>> TaskInfoShow([FromQuery] TaskInfoShowCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 甘特图显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<ProductionTasks>>> Showgtt([FromQuery] ShowGttCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 调拨显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<TransferOrder>>> ShowTB([FromQuery]ShoeTBCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 调拨显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<InventoryTransfer>>> ShowTBS([FromQuery]ShowInventoryTransferCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 采购显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<GoodsPurchaseInfo>>> ShowCG([FromQuery]ShowGoodsPurchaseInfoCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 显示采购
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<CDLBDTO>>> ShowCGXS([FromQuery]ShowCGCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
